package com.example.zhu95.mytimber.ui;

import android.content.Context;
import android.util.AttributeSet;

import xyz.danoz.recyclerviewfastscroller.sectionindicator.title.SectionTitleIndicator;

/**
 * @author zhu95 on 2017/12/11.
 */
public class FolderSectionTitleIndicator extends SectionTitleIndicator<String> {
    public FolderSectionTitleIndicator(Context context) {
        super(context);
    }

    public FolderSectionTitleIndicator(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public FolderSectionTitleIndicator(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public void setSection(String title) {

        // Example of using a single character
        char firstChar = title.charAt(0);
        if (firstChar == '.' && title.length() >= 2) {
            setTitleText("" + firstChar + title.charAt(1));
        } else {
            setTitleText(firstChar + "");
        }

        // Example of using a longer string
        // setTitleText(song.getName());

        // setIndicatorTextColor(song.getAsColor());
    }
}
